<?php
class syllabusController extends appController {    
    public function index($id=null, $name=null, $course_id=null, $subject_id=null){
        $name = serialize($name);
        $create_date = time();
        $modified_date = time();
        if($_SERVER["REQUEST_METHOD"]=='POST'){
            $error = $this->_model->validation();
            if($error){

                    $this->view->set('err',$error);
                     // return $this->view();
                }
                $id = $this->_model->syllabusname($id,$name,$course_id,$subject_id,$create_date,$modified_date);
                if($id != null){
                    header('Location:index');
                    exit;
                }
        }
        $getuniverName = $this->loadModel("courseModel");
        $getscourse=$getuniverName->getcoursefields();
        $this->view->set('getscourse',$getscourse);
        $getsubject = $this->loadModel("subjectModel");
        $getSubject=$getsubject->getSubject();
        $this->view->set('getSubject',$getSubject);
        $getSyllabus = $this->_model->getSyllabus();
        $this->view->set('getSyllabus',$getSyllabus[0]);
        // print_r($getSubject[0]['name']);
        return $this->view();
    }

}
?>